//
//  DSShopTableViewCell.m
//  外星球生活圈
//
//  Created by MR.ZHOU on 15/8/12.
//  Copyright (c) 2015年 MR.ZHOU. All rights reserved.
//

#import "ZFShopTableViewCell.h"
#import "ZFShopCollectionViewCell.h"

static NSString *ID =@"ZFShopCollectionViewCell";
@interface ZFShopTableViewCell ()<UICollectionViewDataSource>
@property (weak, nonatomic) IBOutlet UICollectionView *shopCollectionViewCell;
@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *collectionViewFlowLayout;

@end
@implementation ZFShopTableViewCell

- (void)awakeFromNib {
    [_shopCollectionViewCell registerNib:[UINib nibWithNibName:@"ZFShopCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:ID];
    _shopCollectionViewCell.scrollEnabled = NO;
    _collectionViewFlowLayout.itemSize = CGSizeMake(self.bounds.size.width/4, self.bounds.size.height/2);
    _collectionViewFlowLayout.minimumInteritemSpacing = 0;
    _collectionViewFlowLayout.minimumLineSpacing = 0;
    
    
}
-(void)setList:(GroupList *)list{
    _list = list;
    [_shopCollectionViewCell reloadData];
}
//- (void)setShop:(ShopListModel *)shop{
//    NSLog(@"11111111");
//    _shop = shop;
//      [_shopCollectionViewCell reloadData];
//    
//}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark  UICollectionViewDataSource
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return _list.list.count;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    ZFShopCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
        cell.model = _list.list[indexPath.row];
    
    return cell;
}

@end
